<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								房间名称：<input type="text" name="roName"/>

							</li>

							<li>
								房间使用状态：<!--<input type="text" name="state"/>-->
								<select name="deptId" th:with="type=${@dict.getType('service_item')}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
								</select>
							</li>

							<li>
								部门：<!--<input type="text" name="createTime"/>-->
								<select name="deptId" th:with="type=${@dict.selectDeptName()}">
									<option value="">所有</option>
									<option th:each="dict : ${type}" th:text="${dict.deptName}" th:value="${dict.deptId}"></option>
								</select>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="room:room:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="room:room:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="room:room:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="room:room:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('room:room:edit')}]];
        var removeFlag = [[${@permission.hasPermi('room:room:remove')}]];
        var prefix = ctx + "room/room";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "美容房间",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'roId', 
					title : '主键',
					visible: false
				},
				{
					field : 'deptName',
					title : '部门名称',
					sortable: true
				},
				{
					field : 'roName', 
					title : '房间名称',
					sortable: true
				},
				{
					field : 'state', 
					title : '房间使用状态',
					sortable: true,
                    formatter: function (value, row, index) {
					    if(row.state=='0'){
                            return '<span class="text-danger">未使用</span>';
						}else{
                            return '<span class="text-success">使用中</span>';
						}

                    }
				},
				// {
				// 	field : 'rzyTime',
				// 	title : '房间还剩多长结束',
				// 	sortable: true,
                 //    formatter: function (value, row, index) {
                 //        return statusTools(row);
                 //    }
				// },
				{
					field : 'createTime', 
					title : '房间创建时间',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.roId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.roId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });


        // /* 用户管理-停用 */
        // function disable(userId) {
        //     $.modal.confirm("确认要停用用户吗？", function() {
        //         $.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 1 });
        //     })
        // }
        //
        // /* 用户管理启用 */
        // function enable(userId) {
        //     $.modal.confirm("确认要启用用户吗？", function() {
        //         $.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 0 });
        //     })
        // }
    </script>
</body>
</html>